const Mock = require('mockjs')

const data = Mock.mock({
  'items|10': [{
    id: '@id',
    title: '@title(1, 2)',
    address: '@county(true)',
    service_type: '@word(3, 5)',
    service_content: '@title(3, 5)',
    phone: '@integer(13800000000,13900000000)',
    name: '@cname',
    remarks: '@word(3, 5)'
  }]
})
const supplierData = Mock.mock({
  'items|10': [{
    id: '@id',
    title: '@title(1, 2)',
    address: '@county(true)',
    service_type: '@word(3, 5)',
    service_content: '@title(3, 5)',
    phone: '@integer(13800000000,13900000000)',
    name: '@cname',
    remarks: '@word(3, 5)'
  }]
})
const taskData = Mock.mock({
  'items|10': [{
    id: '@id',
    task: '@sentence(5)',
    start_time: '@datetime',
    end_time: '@datetime',
    name: '@cname' + ' ' + '@cname',
    remarks: '@word(3, 5)',
    'status|1': ['已完成', '未完成']
  }]
})
const accountData = Mock.mock({
  'items|10': [{
    id: '@id',
    title: '@title(1, 2)',
    password: '@string(5)',
    'share|1': true
  }]
})

module.exports = [
  {
    url: '/vue-admin-template/table/list',
    type: 'get',
    response: config => {
      const items = data.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/vue-admin-template/supplier/list',
    type: 'get',
    response: config => {
      const items = supplierData.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/vue-admin-template/task/list',
    type: 'get',
    response: config => {
      const items = taskData.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  },
  {
    url: '/vue-admin-template/account/list',
    type: 'get',
    response: config => {
      const items = accountData.items
      return {
        code: 20000,
        data: {
          total: items.length,
          items: items
        }
      }
    }
  }
]
